local skynet = require "skynet.manager"

local max_client = tonumber(skynet.getenv "max_client")
local server_id = tonumber(skynet.getenv "server_id")
local server_config = dofile(skynet.getenv("server_config"))

skynet.start(function()
	skynet.error("Server start")
	if not skynet.getenv "daemon" and server_config.no_cotainer then
		local console = skynet.newservice("console")
	end
	
	local debug_listen_ip = "127.0.0.1"
	if not server_config.no_cotainer then
		debug_listen_ip = '0.0.0.0'
	end
	skynet.newservice("debug_console",debug_listen_ip, server_config.debug_port)

	local proxy_conn = skynet.newservice('proxy_conn')
	skynet.call(proxy_conn,'lua','start')

	local kafka_queue = skynet.newservice('kafka_queue')
	skynet.name('.kafka_queue',kafka_queue)

	local reload_service = skynet.uniqueservice('reload_service')
	skynet.name('.reload_service',reload_service)
	skynet.call(reload_service,'lua','pull_conf_data')

	local msg_handler = skynet.newservice('msg_handler')
	skynet.name('.msg_handler',msg_handler)
	skynet.call(msg_handler,'lua','start')

	
	skynet.exit()
end)

